package com.ccys.cms.controller.masterData;

import com.ccys.cms.service.masterData.DiagnosisService;
import com.ccys.common.vo.ResponseResult;
import com.ccys.db.dto.masterData.DiagnosisDelDto;
import com.ccys.db.dto.masterData.DiagnosisPageQueryDto;
import com.ccys.db.dto.masterData.DiagnosisSaveDto;
import com.ccys.db.vo.masterData.DiagnosisListVo;
import com.ccys.db.vo.masterData.DiagnosisPageQueryVo;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @program: WhiteCoat
 * @description: 诊断接口
 * @author: ZhangJingCan
 * @create: 2023-12-12 16:52
 **/

@RestController
@RequestMapping("masterData")
@Api(tags = "masterData-诊断接口")
public class DiagnosisController {

    @Autowired
    private DiagnosisService diagnosisService;


    
    @PostMapping("diagnosis")
    @ApiOperation("保存诊断")
    public ResponseResult save(DiagnosisSaveDto dto) {
        return diagnosisService.save(dto);
    }

    @PutMapping("diagnosis")
    @ApiOperation("修改诊断")
    public ResponseResult edit(DiagnosisSaveDto dto) {
        return diagnosisService.save(dto);
    }

    
    @DeleteMapping("diagnosis")
    @ApiOperation("根据ID删除诊断")
    public ResponseResult delete(DiagnosisDelDto dto) {
        return diagnosisService.delete(dto);
    }

    
    @GetMapping("diagnosis")
    @ApiOperation("分页查询诊断")
    public ResponseResult<PageInfo<DiagnosisPageQueryVo>,Object> findPage(DiagnosisPageQueryDto dto) {
        return diagnosisService.findPage(dto);
    }

    @GetMapping("diagnosis/list")
    @ApiOperation("查询诊断集合(只会返回id,name,code)")
    public ResponseResult<List<DiagnosisListVo>,Object> findList() {
        return diagnosisService.findList();
    }


}
